import apis from '../../http/apis/apis'

export default {
    namespaced: true,
    state: {
        users: [],
        usersSubsidiary: []
    },
    mutations: {
        setUsers(state, data) {
            state.users = data
        },
        setUsersSubsidiary(state, data) {
            state.usersSubsidiary = data
        }
    },
    actions: {
        async getUsers({ commit, state }) {
            const data = await apis.adminsUsers.getUsers()
            if (data.code) {
                console.log(data);
                commit('setUsers', data.data)
            }
        },
        async getUsersSubsidiary({ commit, state }) {
            const data = await apis.adminsUsers.getUsersSubsidiary()
            if (data.code) {
                console.log(data);
                commit('setUsersSubsidiary', data.data)
            }
        },
    }
}